//------------------------------------------------------------------------------
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
//------------------------------------------------------------------------------
#include "network/stnmessage.h"
#include "aboutdialog.h"

#include <QCloseEvent>
#include <QMainWindow>
#include <QMenu>
#include <QPixmap>
#include <QStandardItemModel>
#include <QSystemTrayIcon>
//------------------------------------------------------------------------------
namespace Ui {
	class MainWindow;
}
//------------------------------------------------------------------------------
#define DEFAULT_ICON_TEXT_COLOR				QPen("#FF0000")
#define DEFAULT_ICON_BACKGROUND_COLOR		QBrush("#FFFFFF")
#define DEFAULT_ICON_FONT						QFont("Arial")
#define DEFAULT_ICON_SIZE						QSize(22,22)
#define FONT_HEIGHT_FACTOR						0.8
//------------------------------------------------------------------------------
class MainWindow : public QMainWindow{
	Q_OBJECT
//------------------------------------------------------------------------------
// Constructor/Destructor
//------------------------------------------------------------------------------
	public:
		explicit MainWindow(QWidget *parent = 0);
		~MainWindow();

//------------------------------------------------------------------------------
// Signals
//------------------------------------------------------------------------------
	signals:
		void quitRequested();

//------------------------------------------------------------------------------
// Public slots
//------------------------------------------------------------------------------
	public slots:
		void displayMessage(STNMessage);

//------------------------------------------------------------------------------
// Protected methods
//------------------------------------------------------------------------------
	protected:
		void closeEvent(QCloseEvent *evt);

//------------------------------------------------------------------------------
// Private slots
//------------------------------------------------------------------------------
	private slots:
		void iconActivated(QSystemTrayIcon::ActivationReason reason);
		void on_m_clearButton_released();
		void on_m_actionAbout_triggered();
//------------------------------------------------------------------------------
// Private methods
//------------------------------------------------------------------------------
	private:
		void updateIconPix();

//------------------------------------------------------------------------------
// Members
//------------------------------------------------------------------------------
	private:
		Ui::MainWindow *ui;

		AboutDialog *m_aboutDialog;

		QMenu *m_trayMenu;
		QAction *m_quitAction;

		QSystemTrayIcon *m_trayIcon;
		QStandardItemModel *m_notificationsModel;

		QString m_customIconFile;
		ulong m_unreadNotifications;
//------------------------------------------------------------------------------
};
//------------------------------------------------------------------------------
#endif // MAINWINDOW_H
//------------------------------------------------------------------------------
